﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Model
{
    /// <summary>
    /// RESPONSABILITY: -data bucket
    ///                
    /// </summary>
    public class ManufacturingTask:ITask
    {
        public string TaskCode { get; set; }
        public int EstimatedTime { get; set; }
        public Employee AssignedEmployee{get;set;}
        public Machine machine;
        public int ManufacturingTaskId { get; private set; }
        static private List<int> ManufacturingTasksIds;
        IDGenerator idGenerator = IDGenerator.Instance;

        private int ManufacturingTaskId_Generator()
        {
            Type type = typeof(Model.ManufacturingTask);
            return idGenerator.RandomIDGenerator(type);
        }

        public ManufacturingTask(string manufacturingTaskCode, int manufacturingEstimation, Employee _employee, Machine _machine)
        {
            this.TaskCode = manufacturingTaskCode;
            this.EstimatedTime = manufacturingEstimation;
            this.AssignedEmployee = _employee;
            this.machine=_machine;
            ManufacturingTasksIds=new List<int>();
            ManufacturingTaskId = ManufacturingTaskId_Generator();
            ManufacturingTasksIds.Add(ManufacturingTaskId);
           
        }
        
        public double EstimateCost()
        {
            return (this.EstimatedTime*(this.AssignedEmployee.Wage+this.machine.CostPerHour));
        }
    }   
}              
